function isEmpty(str) {
    return str == "" || str == null || str == undefined;
}

function isEmail(value) {
    var valid = true;
    if (!isEmpty(value)) {
        var re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
        valid = re.test(value);
    }

    return valid;
}

function stringFormat() {
    var str = arguments[0];
    for (var i = 0; i < arguments.length - 1; i++) {
        var index = "{" + i + "}";
        while (str.indexOf(index) != -1) {
            str = str.replace(index, arguments[i + 1]);
        }
    }
    return str;
}